package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmGeneralCodeTableMapper;
import com.cm.caseManagement.pojo.entity.CmGeneralCodeTable;
import com.cm.caseManagement.service.ICmGeneralCodeTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 通用码Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmGeneralCodeTableServiceImpl implements ICmGeneralCodeTableService
{
    @Autowired
    private CmGeneralCodeTableMapper cmGeneralCodeTableMapper;

    /**
     * 查询通用码
     *
     * @param id 通用码主键
     * @return 通用码
     */
    @Override
    public CmGeneralCodeTable selectCmGeneralCodeTableById(Long id)
    {
        return cmGeneralCodeTableMapper.selectCmGeneralCodeTableById(id);
    }

    /**
     * 查询通用码列表
     *
     * @param cmGeneralCodeTable 通用码
     * @return 通用码
     */
    @Override
    public List<CmGeneralCodeTable> selectCmGeneralCodeTableList(CmGeneralCodeTable cmGeneralCodeTable)
    {
        return cmGeneralCodeTableMapper.selectCmGeneralCodeTableList(cmGeneralCodeTable);
    }

    /**
     * 新增通用码
     *
     * @param cmGeneralCodeTable 通用码
     * @return 结果
     */
    @Override
    public int insertCmGeneralCodeTable(CmGeneralCodeTable cmGeneralCodeTable)
    {
        cmGeneralCodeTable.setCreateTime(DateUtils.getNowDate());
        return cmGeneralCodeTableMapper.insertCmGeneralCodeTable(cmGeneralCodeTable);
    }

    /**
     * 修改通用码
     *
     * @param cmGeneralCodeTable 通用码
     * @return 结果
     */
    @Override
    public int updateCmGeneralCodeTable(CmGeneralCodeTable cmGeneralCodeTable)
    {
        cmGeneralCodeTable.setUpdateTime(DateUtils.getNowDate());
        return cmGeneralCodeTableMapper.updateCmGeneralCodeTable(cmGeneralCodeTable);
    }

    /**
     * 批量删除通用码
     *
     * @param ids 需要删除的通用码主键
     * @return 结果
     */
    @Override
    public int deleteCmGeneralCodeTableByIds(Long[] ids)
    {
        return cmGeneralCodeTableMapper.deleteCmGeneralCodeTableByIds(ids);
    }

    /**
     * 删除通用码信息
     *
     * @param id 通用码主键
     * @return 结果
     */
    @Override
    public int deleteCmGeneralCodeTableById(Long id)
    {
        return cmGeneralCodeTableMapper.deleteCmGeneralCodeTableById(id);
    }
}
